<!DOCTYPE html>
<html>
<head>
  <title>{% block title %}{% endblock %}</title>
  <!-- 必须的 meta 标签 -->
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <link rel="stylesheet" href="/static/css/base.css">
  <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
  <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
  <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>

  {% block head %}{% endblock %}
</head>
<body>
  <!--导航-->
  <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
    <a class="navbar-brand" href="/">氧化钙</a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
  </button>
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav mr-auto">
        <li class="nav-item active">
          <a class="nav-link active" href="/">首页</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/">发现</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/">下载</a>
        </li>
      <li class="form-inline my-2 my-lg-0" style="margin-left: 30px;">
        <form action="/Search" method="get">
          <input class="form-control mr-sm-2" type="text" placeholder="Search"  name="key" id="key" value>
          <button class="btn btn-outline-success my-2 my-sm-0"  type="submit">Search</button>
        </form>
      </li>
        {% if username == None %}
        <div style="position: absolute;right: 20px;" class="row">
          <a class="nav-link" href="/login">登录</a>
          <a class="nav-link" href="/register">注册</a>
        </div>
        {% else %}
        <div class="nav-item dropdown" style="position: absolute;right: 10px;">
        <a class="nav-link dropdown-toggle" id="navbarDropdown" role="button" data-toggle="dropdown" aria-expanded="false">
        {{ username }}
        </a>
        <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
          <a class="dropdown-item" href="/user">个人中心</a>
          <a class="dropdown-item" href="/myproject">我的作品</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="/logout">退出登录</a>
        </div>
      </div>
      {% endif %}
      
    </ul>

    </li>
    </div>
  </nav>
{% block body %}
{% endblock %}
</body>
</html> 